<script type="text/javascript" src="<?=base_url()?>js/popup.js"></script>
<link href="<?=base_url()?>css/popup.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=base_url()?>js/jquery.lightbox-0.5.js"></script>
<link href="<?=base_url()?>css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url()?>js/jquery.tooltip.js"></script>
<link rel="stylesheet" type="text/css" href="<?=base_url()?>css/jquery.tooltip.css" media="screen" />
<script>
$j(function() {
	$j('.gallery a').lightBox();
	$j('.pic a').lightBox();
	$j('.each *').tooltip({
		showURL: false
	});
	$j(document).ready(function(){
				
	//CLOSING POPUP	
	//Click out event!
	$j("#background-popup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$j(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

}); 
	
});
</script>
<script type="text/javascript">
var error_num=0;
/*
function checkemail(){
	var email = $j('#email').val();
		$j.ajax({
			url: '<?=base_url()?>store/checkemail',
			type: 'POST',
			data: ({email:email}),
			dataType: "html",
			success: function(html) {
				if (html == "Yes") {					
					$j('#email').css('background','#fff3a0');					
					$j('#email_error').html("The email address exists in your system");
					error_num=error_num+1;
				} else {
					$j('#email').css('background','#fff');
					$j('#email_error').html('');
					error_num=0;
				}
			}
		})
}
function checkusername()
{
	var username = $j('#username').val();
		$j.ajax({
			url: '<?=base_url()?>store/checkusername',
			type: 'POST',
			data: ({username:username}),
			dataType: "html",
			success: function(html) {
				if (html == "Yes") {					
					$j('#username').css('background','#fff3a0');			
					$j('#error_username').html(username +" exists in your system");
					error_num=error_num+1;
				} else {
					$j('#username').css('background','#fff');
					$j('#error_username').html('');
					error_num=0;
				}
			}
		})
}
*/
function register() {
	var valid = true;
	if($j('#firstname').val() == "") { $j('#firstname').css('background','#fff3a0'); valid = false; }
	else { $j('#firstname').css('background','#fff'); }
	if($j('#familyname').val() == "") { $j('#familyname').css('background','#fff3a0'); valid = false; }
	else { $j('#familyname').css('background','#fff'); }
	if($j('#email').val() == "") 
	{ 
	$j('#email').css('background','#fff3a0'); 
	valid = false; 
	}
	else
	{
		if(!echeck($j('#email').val()))
		{
			$j('#email').css('background','#fff3a0'); 
	valid = false;
		}
		else
		{
			$j('#email').css('background','#fff');
		}
	}
	/*else {
		var email = $j('#email').val();
		$j.ajax({
			url: '<?=base_url()?>store/checkemail',
			type: 'POST',
			data: ({email:email}),
			dataType: "html",
			success: function(html) {
				if (html == "Yes") {									
					$j('#email').css('background','#fff3a0'); valid = false;					
				} else {
					$j('#email').css('background','#fff');
				}
			}
		})		 
	}*/
	
	/*else { 
		var username = $j('#username').val();
		$j.ajax({
			url: '<?=base_url()?>store/checkusername',
			type: 'POST',
			data: ({username:username}),
			dataType: "html",
			success: function(html) {
				if (html == "Yes") {
					//alert('This username has been used. Please choose another username');
					$j('#username').css('background','#fff3a0'); valid = false;
				} else {
					$j('#username').css('background','#fff');
				}
			}
		})
	}*/
	if($j('#password').val() == "") { $j('#password').css('background','#fff3a0'); valid = false; }
	if($j('#password').val() != $j('#password2').val() || $j('#password2').val() == '') { $j('#password2').css('background','#fff3a0'); valid = false; } else { $j('#password2').css('background','#fff'); }
	if($j('#storename').val() == "") { $j('#storename').css('background','#fff3a0'); valid = false; }
	else { $j('#storename').css('background','#fff'); }
	if($j('#tradename').val() == "") { $j('#tradename').css('background','#fff3a0'); valid = false; }
	else { $j('#tradename').css('background','#fff'); }
	if($j('#phone').val() == "") { $j('#phone').css('background','#fff3a0'); valid = false; }
	else { $j('#phone').css('background','#fff'); }
	if($j('#address').val() == "") { $j('#address').css('background','#fff3a0'); valid = false; }
	else { $j('#address').css('background','#fff'); }
	if($j('#city').val() == "") { $j('#city').css('background','#fff3a0'); valid = false; }
	else { $j('#city').css('background','#fff'); }
	if($j('#state').val() == "") { $j('#state').css('background','#fff3a0'); valid = false; }
	else { $j('#state').css('background','#fff'); }
	if($j('#postcode').val() == "") { $j('#postcode').css('background','#fff3a0'); valid = false; }
	else { $j('#postcode').css('background','#fff'); }
	if (valid&& error_num==0) {
		document.registerForm.submit();
	} else {
		alert('Please check the highlighted fields to make sure you have entered the correct data.');
		return false;
	}
}
function echeck(str) {

                var at = "@"
                var dot = "."
                var lat = str.indexOf(at)
                var lstr = str.length
                var ldot = str.indexOf(dot)
                if (str.indexOf(at) == -1) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }

                if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }

                if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }

                if (str.indexOf(at, (lat + 1)) != -1) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }

                if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }

                if (str.indexOf(dot, (lat + 2)) == -1) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }

                if (str.indexOf(" ") != -1) {
                    alert("Please Enter A Valid E-mail")
                    return false
                }


                return true;
            }
function reset() 
{
	if($j('#reset').val() == '')
	{
		alert('Please enter your password');
		return false;
	}
	$j('#popup-shopping').show();
			centerPopup();
			loadPopup();
	setTimeout(function(){
     
			document.passwordForm.submit();
                }, 1000);
	 
	
	
	/*
	if($j('#password-login').val() == '')
	{
		alert('Please enter your password');
		return false;
	}
	*/
	
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=500,height=200,left = 440,top = 225');");
}

</script>

<div id="popup-box">
  
    <div id="popup-shopping" style="display:none;">
    	<div class="close"><a href="javascript:disablePopup()"><img src="<?=base_url()?>img/CloseButton-Up.png" alt="Close" /></a></div>
        <div style="clear:both"></div>
        <div style="clear:both;padding-top:54px">
           <div id="content-pop" style="width:408px;margin:0 auto">
           	Your password already be changed
           </div>
        </div>
        <br/>
    </div>
</div>
<div id="background-popup"></div>
		<div id="store">            
            <div class="customer"><p><img src="<?=base_url()?>img/ResetPassword.jpg" alt="Reset Password" /></p>
              <div class="login" style="background:#fff !important;">
               <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                <!--
                 <td width="430" valign="top"><div class="italic-text">
                	<p>Existing franchises login to your account by entering your username and password. If you have forgot your password click the link below and a password will be sent to your email account.</p></div>
                    <div style="margin-top:28px"><a href="javascript:popUp('<?=base_url()?>forgot-password')"><img src="<?=base_url()?>img/forgotPassword.jpg" alt="Forgot password"></a></div>
                 </td>-->
                 <td width="100%" valign="top"><div class="italic-text">
                 	This is the first time you have logged in. Please reset your password to proceed to checkout. 
                 	<br><br><br> 
                 	<div class="box" style="float:none!important;">
                 		<form name="passwordForm" method="post" action="<?=base_url()?>store/new_reset_password">
                		<dl><dt style="line-height:normal; width:150px;">Reset your password</dt>
                			<dd style="margin-left: 10px;">
                				<input type="text" style="width:280px;border:1px solid #e5e5e5;" name="reset" id="reset"  />
                				<!--<input type="text" name="reset" id="reset" style="width:280px" /></dd></dl>-->
                				<br>
                    	<dl style="clear:both"></dl>
                    	</form>
                    	 
                 	</div>
                 	<br><br><br>
                 	<div style="margin-left:233px;">
                 	<a onclick="javascript:reset()"><img src="<?=base_url()?>img/ResetPassButton.jpg" alt="Reset Password"></a>
                 	</div>	
                 	<?php if($this->session->flashdata('error_update')) { ?><div style="clear:both"></div><div class="error"><?=$this->session->flashdata('error_update')?></div><?php } ?>
                 </td>
                 
                
                
               </tr>
              </table>
            </div><!--<div style="border-bottom:1px solid #e8e8e8;clear:both;height:1px;margin-top:2px;margin-bottom:4px"></div>-->
            </div>
            <div class="customer">
            <!--
            <form name="registerForm" method="post" action="<?=base_url()?>store/traderegister" autocomplete="off" >
            	<p><img src="<?=base_url()?>img/newmemberHeader.jpg" alt="Don't have a member account? New Franchises signup below " /></p>
                 <div class="signup">
                   <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                     <td width="478" valign="top">  
                      <p style="width:478px;" class="italic-text">If you are a new franchise and would like to purchase you will need to set up a members account via filling in the form below. New membership applications go through an approval process. Only legitimate 7 Eleven franchise owners can purchase from the 7 Eleven merchandise store.</p>
                     </td>
                     <td align="right" width="386" valign="bottom"><div class="italic-text" style="text-align:right;">* Denotes Required Field</div>
                     </td>
                    </tr>
                   </table>
                   <div style="clear:both"><br/></div>
                   <?php if($this->session->flashdata('signup_mes'))
				   {
					   echo '<div class="error">'.$this->session->flashdata('signup_mes').'</div>';
				   }
					   ?>
                  <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                     <td width="478" valign="top">  
                       <table cellpadding="0" cellspacing="0" border="0">
                         <tr height="38">
                           <td>First Name *</td><td><input type="text" name="firstname" id="firstname" style="width:280px;border:1px solid #e5e5e5;" /></td>
                         </tr>
                         <tr height="38"><td>Family Name *</td><td><input type="text" name="familyname" id="familyname" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Your Email *</td><td><input type="text" name="email" id="email" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td width="140">Choose a Password *</td><td><input type="password"  name="password" id="password" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Retype Password *</td><td><input type="password"  name="password2" id="password2" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Store Name *</td><td><input type="text" name="storename" id="storename" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Trading Name *</td><td><input type="text" name="tradename" id="tradename" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                       </table>
                    </td>
                    <td valign="top">
                      <table cellpadding="0" cellspacing="0" border="0">
                         <tr height="38">
                           <td>Address 1 *</td><td><input type="text" name="address" id="address" style="width:280px;border:1px solid #e5e5e5;" /></td>
                         </tr>
                         <tr height="38"><td width="96">Address 2</td><td><input type="text" name="address2" id="address2" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         
                         <tr height="38"><td>Suburb *</td><td><input type="text"  name="city" id="city" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>State *</td><td><input type="text"  name="state" id="state" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Postcode *</td><td><input type="text" name="postcode" id="postcode" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Phone *</td><td><input type="text" name="phone" id="phone" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                         <tr height="38"><td>Mobile</td><td><input type="text" name="mobile" id="mobile" style="width:280px;border:1px solid #e5e5e5;" /></td></tr>
                       </table>
                     <div style="margin-top:10px;text-align:right;float:right;clear:both"><a onclick="javascript:register()"><img src="<?=base_url()?>img/signUp.jpg" alt="Sign up"></a></div>
               </td>
              </tr>
             </table>
            </div>
            </form>
            -->
            </div>
            
        </div>